# Contributor: rubicon <rubicon@mailo.com>
# Maintainer: rubicon <rubicon@mailo.com>
pkgname=epic5
pkgver=2.1.12
pkgrel=0
pkgdesc="Enhanced Programmable ircII Client, version 5"
url="http://epicsol.org/"
arch="all"
license="BSD-3-Clause"
makedepends="libarchive-dev ncurses-dev openssl-dev perl-dev"
subpackages="$pkgname-doc $pkgname-script:script:noarch $pkgname-lite"
source="http://ftp.epicsol.org/pub/epic/EPIC5-PRODUCTION/epic5-$pkgver.tar.gz
	default-to-oftc.patch
	"
# dir for lite variant without libarchive and perl support
_litedir="$srcdir/$pkgname-$pkgver"/lite

build() {
	mkdir -p "$_litedir"
	cp -r configure Makefile.in include source "$_litedir"/

	./configure \
		--build="$CBUILD" \
		--target="$CTARGET" \
		--prefix=/usr \
		--with-ipv6
	make

	cd "$_litedir"
	./configure \
		--build="$CBUILD" \
		--target="$CTARGET" \
		--prefix=/usr \
		--with-ipv6 \
		--without-libarchive \
		--without-perl
	make
}

check() {
	"$builddir"/source/epic5 -v
	"$_litedir"/source/epic5 -v
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 -t "$pkgdir"/usr/share/doc/epic5 \
		"$builddir"/doc/*
	rm "$pkgdir"/usr/share/doc/epic5/epic*.1
}

script() {
	pkgdesc="$pkgdesc (bundled scripts)"
	depends="cmd:$pkgname=$pkgver-r$pkgrel"
	amove usr/share/epic5
}

lite() {
	pkgdesc="$pkgdesc (dependency-lite variant)"
	cd "$_litedir"
	make DESTDIR="$subpkgdir" installbin
	rm -vrf "$subpkgdir"/usr/share
}

sha512sums="
98c42babe198191306606f1d227389ed33fcdfca623b21aaa1950b5e96832947abedd102f386697df8d7c0afb94470f8020613606175e956d508c6bb0b1ac6da  epic5-2.1.12.tar.gz
b89098e2a5ba34b9b28714e3ed94230a5e9b56f455eb4e38d0108229633056df55de6e5a89a2f6459f8b034785b8774bf94eaeb35bfe6353de54b3b013f18da5  default-to-oftc.patch
"
